wildpocketsfandomcom-20200213-history
Programming Manual Chap. 17
Modeling Basics Currently, 3D models and animations for Wild Pockets can be created using either Autodesk 3D Studio Max, or Autodesk Maya. In the future, we intend to support a large range of modeling programs: XSI, Lightwave, Sketchup. However, at this stage, only these two are supported. Using 3D Studio Max Max Modeling for Wild Pockets This chapter is about how to model in 3D Studio Max for Wild Pockets with the best possible results. This tutorial will explain how to install the exporter, model efficiently for Wild Pockets, create collision volumes, and other important topics. Installing the Exporter There are two files that must be on your computer to make the exporter work properly. One is a Max plugin with a DLO extension, the other is the executable file CURL.EXE. You must choose the right plugin for your version of Max. The plugin DLO contains the Max version number in its filename. For example, the right plugin for Max 2008 is the DLO with 2008 in its filename. If you're using a 64-bit version of Max, make sure to download an x64 version of the DLO. The DLO file must be dropped into the Max plugins directory (which is normally located at 'Program Files/Autodesk/3D Studio Max/plugins'). The program CURL.EXE should be dropped into your windows directory. The Export Helper Most Max export plugins show up in the File/Export menu. The Wild Pockets exporter is an exception! The Wild Pockets exporter is a helper object. You must add the export helper to your scene. Go to the creation tab in Max, and select the helpers category. In the drop-down menu, a new item should show up entitled Exporters. Select this and then left-click the WildPockets button. With this highlighted, left-click anywhere in your scene to create the export helper, which should look like a green wireframe. This is the WildPockets exporter; it does not change size, and its location does not matter, so once you place the object, you can ignore it until you are ready to actually export your meshes. You should only put one of them in your scene. The Exporter's Interface Once you place the exporter in your scene, you can continue to work with it by selecting it and going to the Modify Tab. The exporter can subdivide your Max file into multiple art assets. For example, if you model a scene with a tree and a house, the exporter can export the tree into one file, and the house into a different file. You must configure which meshes go into which files. To make this possible, the export helper modify panel contains these buttons: *Add: Use this to add a new art asset file to the list. You will have to tell the exporter which meshes go into this art asset file. *Edit: Use this to change the name or which meshes to include in a given art asset file. *Remove: Use this to delete an art asset file from the list. In addition, the export helper modify panel contains a big "Export Now" button. When you push this, the exporter will create all the art asset files in the list. These files are created directly inside your Wild Pockets library, not on your hard drive. After adding your meshes to the exporter, they will be listed within the exporter according to their filename and the type. If you do not want to be asked whether or not writing over a file is okay, check the 'Overwrite Existing File' box. The Add Dialog To tell it to create an art asset, click the 'add' button in the export helper modify panel. This brings up the 'add' dialog. The add dialog contains many questions. Most of these questions can be ignored at first, but some have to be answered. Here are the questions you must answer: *'Export Type': Do you want to export a Model or Animation? *'Wild Pockets userID': What userID do you use to log in to the Wild Pockets website? *'Library Filename': What filename do you want the art asset to have in your library? In addition, you may be interested in these additional questions, but normally, you can just leave them at their default values: *'Objects to Export': If it's a model, what meshes are part of the model? By default, it will assume that all the meshes in your scene are part of the model. *'Frames to Export': If it's an animation, what range of frames do you want to export? By default, it will export the entire animation, beginning to end. *'Physics Properties': How much does the object weigh, in kilograms? And, do you want to manually control the moment of rotational inertia (only for very advanced users). *'Render Options': There's a flag here, 'combine meshes', but it's not currently in use. *'Scripted Behavior': Do you want to associate this model with a Lua script file? Make a Wild-Pockets-Compatible Model You need to create models that are compatible with Wild Pockets. Not everything that you can create in Max will work in Wild Pockets. The following is a checklist of things that you need to do in a Wild-Pockets-Compatible way: *Get the scale right. *Face the model in the right direction. *Center the model properly. *Create collision volumes. *Manage the center of mass. *Use Wild-Pockets-Compatible materials. *Heed Wild Pockets performance limitations. Each of these is explained below. Get the Scale Right One Max unit translates to one Wild Pockets meter. A Human should be modeled about two meters high: ie, two Max units. This is going to look a little funny, because the default Max grid is too big for this to look right. Adjust the Max grid if it helps you to remember. Face your Model in the Right Direction There are two ways to orient a model: using the Max Grid, or using a Compass Helper. Option 1 is to use the Max Grid. When using the Grid, the character must be facing toward the +Y axis of the grid. You will need to rotate the character such that when he moves forward, his Y coordinate is getting bigger. Option 2 is to use the Compass Helper. Use the Max creation panel to create a Compass Helper object. In this case, the character must be facing 'north' according to the compass. You can accomplish this by turning the character, or by turning the compass. Either way, just make sure the north-arrow on the compass is pointing the same way as the character is facing. Center the Model Properly There are two ways to center a model: using the Max Grid, or using a Compass Helper. Option 1 is to use the Max Grid. When using the grid, the grid center must be directly under the character's feet. If it's the kind of object that moves off of the ground, it may be desirable to put the grid center right in the middle of the object - this would be ideal for a model such as an airplane or a basketball. Option 2 is to use the compass helper. In that case, the compass helper should be directly under the character's feet - or in the case of an object that doesn't stay on the ground, in the object's center. Creating Collision Volumes The Physics system pays no attention to the polygons of your model: objects pass right through polygons. To make your object substantial, you must give it collision volumes: simple, primitive shapes that approximate the overall shape of your mesh. The Wild Pockets exporter interprets Atmospheric Apparatuses as collision volumes. Atmospheric Apparatuses can be found under the Helpers category where the exporter was originally. Here, you should see two important types: BoxGizmo and SphereGizmo. DO NOT USE CylGizmo! It does not do anything. Place these collision objects so that they "cover" the overall shape of your model. It is fine for them to overlap. You should use at most four or five volumes per object. Of course, it will usually not be possible to exactly replicate the shape of the model using a few volumes. Just approximate as closely as you can. Note, spherical collision volumes are limited: they must stay perfect spheres! Turning them into hemispheres by setting the hemisphere flag doesn't work. Also, turning them into ellipses by scaling them nonuniformly doesn't work. Only true spheres can be exported. You can rotate and scale collision boxes as needed. You should name your collision volumes appropriately so you do not get them confused with other objects that may exist in your scene. Managing the Center of Mass Your model has two centers: the 'mathematical center' which is considered coordinate (0,0,0), and the 'center of mass' that the object tends to spin around when it has rotational inertia. For example, with a human character, the mathematical center is usually placed directly between the feet, but the center of mass is usually around the pelvis. Usually, the physics system does a reasonable job of selecting a center-of-mass for your object. It does so by studying the layout of your collision volumes and by assuming that they are of uniform density. However, if you don't like its choice, you can take matters into your own hands. To control the center of mass, put a point helper in your scene. Position this point helper where you want the center of mass to be. You must check the following boxes in the point helper: *YES display center marker *NO display axis tripod *YES display cross *NO display box If you do not check this exact combination, the point helper will be ignored. Wild-Pockets-Compatible Materials Max has dozens if not hundreds of material types. Wild Pockets understands only two of these: Standard Materials, and Multi/Sub-Object materials. Nothing else is understood, the exporter will complain if you use anything else. Furthermore, the material editor contains hundreds of check boxes, sliders, and color settings that you can configure. Once again, Wild Pockets understands almost none of these. The only things that Wild Pockets does understand are the filenames of the Diffuse Map, the Glossiness Map, and the Normal Map. The diffuse map can be JPG or PNG. The glossiness map must be a black/white JPG or PNG. The normal map must be a colored JPG or PNG - it will look bluish if it's a proper normal map. Texture sizes must be powers of two: ie, 4, 8, 16, 32, 64, 128, 256, 512, or 1024. They don't have to be square: for example, you can use a texture that's 512x64. Heed Performance Limits There are a number of things you can do that will slow Wild Pockets down. This includes using too many polygons, using too many models, using too many textures, and so forth. See the chapter on profiling your game to learn more about Wild Pockets's performance limits. The Export Now Button When you hit the Export Now button, the exporter will attempt to upload your models to the Wild Pockets file server. At this time, you will see several black windows with numbers and words flashing by rapidly. This is supposed to happen. After the export, a dialog will appear telling you whether or not the export was a success. Using Maya The Maya Wild Pockets Exporter This chapter explains how to use the Wild Pockets Exporter for Maya. It will explain how to install the exporter, model efficiently for Wild Pockets, create collision volumes, and other important topics. Installing the Exporter There are two files that must be on your computer to make the exporter work properly. One is the MEL Script that is the exporter itself, and the other is the executable file CURL.EXE. The MEL script can be placed anywhere on your system. You can invoke it by dragging it into the Maya window. The program curl.exe should be dropped into your Windows directory (probably C:\Windows). Preparing your Models Now that you have made the exporter, you need to make sure you models are ready. When it comes to modeling resolution, there are no true limits, but it is suggested that none of your models should be over 3,000 triangles. This will help the game run smoothly. It is important to get the scale right! One Maya unit translates to one Wild Pockets meter. A Human should be modeled about two meters high: ie, two Maya units. Adjust the Maya grid if it helps you to remember. Next, placing the object correctly on the coordinate grid is very important. In general, the object should always be neatly on top of the coordinate origin. If it's an object that has a "front", the front should be facing toward the -Z axis. For example, if it's a character, the character should face the -Z axis. Exporting a Scene The exporter window contains a big "EXPORT SCENE" button. When you push this, the exporter will ask you to log in (if you are not already logged in) and then ask you for a name for the file. It will then create the file directly inside your Wild Pockets library, not on your hard drive. After the export, a dialog will appear telling you whether or not the export was a success. During the export, it may appear as if Maya has stopped responding. Don't worry, it more than likely hasn't. Be patient, and your export will finish. Controlling the Center of Mass Usually, the physics system does a reasonable job of selecting a center-of-mass for your object. However, if you don't like its choice, you can take matters into your own hands. To control the center of mass, click the "Create Center of Mass" button. This will create a locator. Position this locator where you want the center of mass to be. If you want further control, you may check the "Use Center of Mass axes for inertia calculations" box. This will enable you to use the axes of the locator to describe the object's moment of inertia. For further information, see the Help button in the top-right corner of the Exporter. Controlling the Collision Volumes The Wild Pockets exporter allows you two add two kinds of collision volumes: boxes and spheres. To add these to your scene, press their corresponding buttons on the Exporter window. Note that regardless of how you organize your Hypergraph, only collision volumes that you create using these buttons will be used as collision. Anything else will be rendered. Place these collision objects so that they "cover" the overall shape of your model. It is fine for them to overlap. You should use at most four or five volumes per object. Of course, it will usually not be possible to exactly replicate the shape of the model using a few volumes. Just approximate as closely as you can. Note, spherical collision volumes are limited: they must stay perfect spheres! Turning them into ellipses by scaling them nonuniformly doesn't work. Only true spheres can be exported. You can rotate and scale collision boxes as needed. For further information, see the Help button in the top-right corner of the Exporter. Applying Textures Wild Pockets supports three kinds of textures: diffuse maps, gloss maps, and norrmal maps. They should be attached to lamberts if you're not using a gloss map or phongs if you are. The diffuse map can be jpg or png, and should be attached to the lambert or phong's color. The gloss map must be a black/white jpg, and should be attached to the phong's specularColor. The normal map must be a colored jpg (it will look bluish if it's a proper normal map), and should be attached to the lambert or phong's normalCamera. If you supply both a normal map and a glossiness map, they must be the same size. Texture sizes must be powers of two: ie, 4, 8, 16, 32, 64, 128, 256, 512, or 1024. They don't have to be square: for example, you can use a texture that's 512x64. Exporting Animations To export an animation, hit the "EXPORT ANIMATION" button, which will act like the "EXPORT SCENE" button, but will upload the animation for the file instead. With the "All Frames in Timeline" button selected, it will export the whole animation as one file. With the "Range of Frames" button selected, you may input a starting frame and an ending frame. The "EXPORT ANIMATION" button will then export only that range of frames, in case you want to store multiple animations in the same file. For further information, see the Help button in the top-right corner of the Exporter. Classes The Exporter will allow you to set a default script class for your object, so that when it is added to the scene it will automatically be of that class. Before you export, put the name of the script containing the class in the "Script containing class" field and the class name itself in the "Default class name" field. Then, when you export, the Scene Object will be set to this script class by default. Ask your scripter for details, and for further information, see the Help button in the top-right corner of the Exporter. Keywords Keywords will enable you to add search terms to your model or animation, so that it can be more easily found in the library. For whichever you are exporting, click on the corresponding "Add/Edit Keywords" button to bring up the keywords for that model or animation. To add a keyword, type it into the box and click "Add Keyword." To remove a keyword, select it and click "Remove Selected Keyword." When you have created your keyword list, click "OK." When you export your art, it will be exported with these keywords, which you can then use to search the Wild Pockets library for them. As always, for further information, see the Help button in the top-right corner of the Exporter.